package work812;

import java.io.*;
import java.util.Scanner;

public class work3 {
  public static void main(String[] args) {
    DataInputStream dis = null;
    DataOutputStream dos = null;
    try {
    Scanner sc = new Scanner(System.in);
    System.out.println("请输入:");
    String name = sc.next();
    File file = new File("E:\\bdqn\\javaDemo\\"+name);

    if (file.exists()) {
      dos = new DataOutputStream(new FileOutputStream("E:\\bdqn\\javaDemo\\copy_" + file.getName()));
      dis = new DataInputStream(new FileInputStream(file));
      byte[] bytes = new byte[(int) file.length()];
      dos.write(bytes);
      dos.flush();;
    }
      } catch (Exception e) {
        e.printStackTrace();
      } finally {
      try {
        dis.close();
        dos.close();
      } catch (IOException e) {
        e.printStackTrace();
      }
      ;

      }
    }

}
